<?php

class AdminController extends \BaseController {

	/**
	 * Display a listing of the resource.
	 *
	 * @return Response
	 */
	public function upload_one_file($name){
		$file = Input::file($name);
		$client_extension = $file -> guessClientExtension();
		// 判断不同扩展名文件上传至不同文件夹
		if(in_array($client_extension ,array('jpg','jpeg','gif','png','bmp'))){
			$floder = 'upload/images';
		}elseif(in_array($client_extension ,array('rar','zip','tar.gz','gz','tpz','7z','iso','bin'))){
			$floder = 'upload/files';
		}
		else return false;

		$filename = str_random(6).'_'.$file->getClientOriginalName();
		$uploadSuccess = $file->move($floder, $filename);
		return '/'.$floder.'/'.$filename;
		
	}


}
